package com.htl.exampro.question.controller;

import com.htl.exampro.base.model.ServerResponse;
import com.htl.exampro.question.pojo.vo.QuestionTypeVO;
import com.htl.exampro.question.service.QuestionTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 题型代码表 前端控制器
 * </p>
 *
 * @author hehehe
 * @since 2025-05-25
 */
@Tag(name = "题目类型管理", description = "题目类型相关接口")
@RestController
@RequestMapping("/questionType")
public class QuestionTypeController {

    @Autowired
    private QuestionTypeService questionTypeService;

    @Operation(summary = "查询题目类型", description = "查询全部题目类型")
    @GetMapping("/list")
    public ServerResponse<List<QuestionTypeVO>> queryAllQuestionType() {
        return ServerResponse.success(questionTypeService.queryAllQuestionType());
    }

    @Operation(summary = "新增题目类型", description = "新增题目类型")
    @PostMapping("")
    public ServerResponse<Void> saveQuestionType(@RequestBody @Validated QuestionTypeVO questionTypeVO) {
        questionTypeService.saveQuestionType(questionTypeVO);
        return ServerResponse.success();
    }


}
